<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/7/20 星期日
  Time: 16:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE html>
<html>

<head>
    <base href="${pageContext.request.contextPath}/" />
    <title>襄阳蓝芯智能化办公系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="static/bootstrap-3.3.5/css/bootstrap.css" rel="stylesheet">
    <link href="static/bootstrapvalidator/css/bootstrapValidator.css"
          rel="stylesheet">

    <script src="static/jquery/jquery-1.10.2.min.js"></script>
    <script src="static/bootstrap-3.3.5/js/bootstrap.js"></script>
    <script src="static/bootstrapvalidator/js/bootstrapValidator.js"></script>

</head>
<body>


<div class="panel panel-primary">
    <div class="panel-heading">
        <h4 class="panel-title">编辑基础数据</h4>
    </div>

    <div class="panel-body">
        <form action="hr/jc-basicdatavalue/addBasicdata" id="myform" method="post"
              class="form-horizontal" role="form">
            <div class="col-md-12">
                <div class="form-group col-md-6">
                    <label for="name" class="col-md-4 control-label">名称</label>
                    <div class="col-md-8">
                        <input type="hidden" id="oid" name="oid" value="">
                        <input type="text" id="name" name="name"
                               class="form-control" placeholder="请输入名称"
                               value="">
                    </div>
                </div>

                <div class="form-group col-md-6">
                    <label for="type" class="col-md-4 control-label">类型</label>
                    <div class="col-md-8">
                        <select name="type"  class="form-control" id="type">
                                <option value="">--请选择--</option>
                            <c:forEach items="${basicdatavalueTypes}" var="basicDataType">
                                <option value="${basicDataType.id}">--${basicDataType.name}</option>
                            </c:forEach>
                        </select>

                    </div>
                </div>
            </div>


            <div class="col-md-12">
                <div class="form-group col-md-12">
                    <label for="status" class="col-md-2 control-label">状态</label>
                    <div class="col-md-9" id="status">
                        <label class="radio-inline">
                            <input type="radio" name="state"  value="Y">可用
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="state"  value="N">不可用
                        </label>
                    </div>
                </div>
            </div>


            <div class="col-md-12">
                <div class="form-group col-md-12">
                    <div class="col-md-10  col-md-offset-2">
                        <a type="button" href="javascript:history.back()" class="btn btn-info">返回</a>
                        <button type="submit" id="editbasicdatabtn" class="btn btn-success">提交信息</button>
                        <button type="reset" id="resetbtn" class="btn btn-default">取消操作</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>







<script type="text/javascript">
    $(document).ajaxError(function(event,xhr) {
        if(xhr.status=="403"){//没有权限
            document.location.href = xhr.getResponseHeader("url");
        }else if(xhr.status!="200"){
            //alert("服务器错误!");
            console.log("服务器错误!");
        }
    });
</script>

</body>


<script type="text/javascript">
    $(document).ready(function() {
        $("#myform").bootstrapValidator({
            message : 'This value is not valid',
            feedbackIcons : {/*input状态样式图片*/
                valid : 'glyphicon glyphicon-ok',
                invalid : 'glyphicon glyphicon-remove',
                validating : 'glyphicon glyphicon-refresh'
            },
            fields : {
                name : {
                    validators : {
                        notEmpty : {/*非空提示*/
                            message : '名称不能为空'
                        },
                        stringLength : {
                            min : 2,
                            max : 20,
                            message : '名称长度需在2-20位'
                        },
                        remote:{
                            url:"hr/jc-basicdatavalue/checkBasicdataName",
                            delay:500,
                            type:'post',
                            message:'名称已存在!',
                            data:function(validator){
                                return {
                                    'name':$("#name").val()
                                };
                            }
                        }
                    }
                },
                type : {
                    validators : {
                        notEmpty : {/*非空提示*/
                            message : '类型不能为空'
                        }
                    }
                },
            },
            submitHandler : function(validator,form, submitButton) {
                validator.defaultSubmit();
            }
        });


        $("#resetbtn").click(function() {
            $("#myform").data("bootstrapValidator").resetForm();
        });
    });



</script>
</html>